package com.itheima.dao;

import com.github.pagehelper.Page;
import com.itheima.entity.PageResult;
import com.itheima.entity.QueryPageBean;
import com.itheima.pojo.CheckItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface CheckItemDao {
    @Insert("insert into t_checkitem values (#{id},#{code},#{name},#{sex},#{age},#{price},#{type},#{remark},#{attention})")
    void add (CheckItem checkItem);
    @Select({" <script>" +
            "select * from t_checkitem"+
            " <if test=\"value != null and value.length != 0\">"+
            "where code = #{value} or name = #{value}"+
            "</if> " +
            " </script>"})
    Page<CheckItem> findPage(String condition);
    @Select("select count(1) from t_checkgroup_checkitem where checkitem_id = #{checkitem_id}")
    Long findCountByCheckItemId(Integer checkitem_id);
    @Delete("delete from t_checkitem where id = #{id}")
    void deleteById(Integer id);
    //此方法的查询语句在xml里
    void updateById (CheckItem checkItem);
    @Select("select * from t_checkitem where id = #{id}")
    CheckItem findById(Integer id);
    @Select("select * from t_checkitem")
    List<CheckItem> findAll();
}
